import random
import string
from functools import reduce

def generate_password(length=12, **options):
    """
    智能密码生成器
    
    Args:
        length: 密码长度
        **options: 配置选项
            - include_uppercase: 包含大写字母
            - include_numbers: 包含数字  
            - include_symbols: 包含符号
    """
    # 构建字符集
    charset = ""
    if options.get('include_uppercase', True):
        charset += string.ascii_uppercase
    if options.get('include_lowercase', True):
        charset += string.ascii_lowercase
    if options.get('include_numbers', True):
        charset += string.digits
    if options.get('include_symbols', False):
        charset += "!@#$%^&*"
    
    # 生成密码
    return ''.join(random.choices(charset, k=length))

# 使用示例
simple_pwd = generate_password(8)
complex_pwd = generate_password(16, include_symbols=True)
safe_pwd = generate_password(20, include_symbols=True, include_uppercase=True)

print(f"简单密码: {simple_pwd}")
print(f"复杂密码: {complex_pwd}")
print(f"安全密码: {safe_pwd}")